import Vue from 'vue'
import Vuex from 'vuex'
import about from './about'
import login from './login'
import home from './home'
import project from './project'
import common from './common'
import task from './task'
import system from './system'

import httpSer from "@/http";
Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
      testB: "Test B",
      totalMsg: 0,
    },
    mutations: {
      upDateTotalMsg(state, data){
        state.totalMsg = data
      }
    },
    actions: {
      getTotalMsg({ commit }, params){
        httpSer.post('/msgInfo/pageMsgInfo', {msgStatus: 2}).then(res => {
          commit('upDateTotalMsg', res.total)
        })
      },
      updateA() {
        console.log('unpateA')
      },
    },
    modules: {
      about,
      home,
      project,
      common,
      task,
      system,
      login
    }
})

export default store